Skip to content

fix(api): a short deploy token disables only /api/admin - #31

Merged
Madraka merged 1 commit into
mainfrom
fix/api-short-deploy-token
Oct 20, 2026
Merged

Madraka merged 1 commit into
mainfrom
fix/api-short-deploy-token

Conversation

@Madraka

@Madraka Madraka commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Problem

A CLOUDHAL_DEPLOY_TOKEN shorter than 32 characters threw inside createApi, so every /api request of the admin Worker returned 500 (Cloudflare 1101). Studio loaded, but sign-in, publishing and health all failed. This happened in a real Deploy to Cloudflare test: the owner edited CLOUDHAL_DEPLOY_TOKEN in the dashboard instead of CLOUDHAL_SETUP_TOKEN.

Change

  • packages/api/src/routes/admin-mount.ts (new): mounts /api/admin. With a short token it logs one clear console.error and makes /api/admin/* answer 503 deploy_token_invalid. Nothing else is affected.
  • /api/health still returns 200, now with problems: ["deploy_token_invalid"] when the token is short. features.deployTransfer becomes false in that case.
  • setupInstructions() (Workers Builds) and docs/guides/deploy-button.md say plainly not to edit CLOUDHAL_DEPLOY_TOKEN, because every build replaces it, and how to recover.
  • Changeset: patch for @cloudhal/api and @cloudhal/cli. createApi shrank, so the size baseline was ratcheted down.

Tests

  • New short deploy token tests in packages/api/test/admin.test.ts. They replace the old toThrow(/32/) assertion.
  • @cloudhal/api full suite: 363 passed. deploy-workers-builds.test.ts: passed. api and cli typecheck: clean. size:check and biome: clean.
  • Full pnpm check was not run (machine-load constraint).

🤖 Generated with Claude Code

A CLOUDHAL_DEPLOY_TOKEN under 32 characters threw in createApi, so every
/api request of the admin Worker failed with 500 (Cloudflare 1101). This
happened when an owner edited CLOUDHAL_DEPLOY_TOKEN instead of
CLOUDHAL_SETUP_TOKEN after a Deploy to Cloudflare install.

Now the admin routes answer 503 deploy_token_invalid, the problem is
logged once, /api/health reports it and the rest of the API keeps
working. The Workers Builds setup steps and the deploy button guide say
not to edit CLOUDHAL_DEPLOY_TOKEN.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Madraka <asker_17@msn.com>
Copilot AI balanced review requested due to automatic review settings October 20, 2026 19:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@Madraka
Madraka merged commit 8c68062 into main Oct 20, 2026
4 checks passed
@Madraka Madraka mentioned this pull request Oct 20, 2026
Madraka added a commit that referenced this pull request Oct 20, 2026
fix(api): a short deploy token disables only /api/admin
Madraka added a commit that referenced this pull request Oct 20, 2026
A deploy token shorter than 32 characters disables only /api/admin
instead of failing every /api request (#31). The README gains the
Deploy to Cloudflare button (#18).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Madraka <8898640+Madraka@users.noreply.github.com>
@Madraka
Madraka deleted the fix/api-short-deploy-token branch October 20, 2026 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants